package com.comcast.core.eeg.types;

import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Event implements java.io.Serializable {

    private static final long serialVersionUID = 1L;

    private java.lang.String eventName;

    private EventDetails details;

    private String eventID;

    private Map<String, Serializable> properties = new HashMap<String, Serializable>();

    public Event() {}

    public Event(String eventName, EventDetails details) {
        this.eventName = eventName;
        this.details = details;
    }

    public void clearProperties() {
        properties.clear();
    }

    public Serializable getProperty(String name) {
        return properties.get(name);
    }

    public boolean setProperty(String name, Serializable value) {
        if (name == null || value == null) {
            return false;
        }

        // check supported data type
        if (value instanceof Boolean || value instanceof Byte
                || value instanceof Short || value instanceof Integer
                || value instanceof Long || value instanceof Float
                || value instanceof Double || value instanceof String) {
            properties.put(name, value);
            return true;
        } else {
            return false;
        }
    }

    public boolean propertyExists(String name) {
        return properties.containsKey(name);
    }

    public Set<String> getPropertyNames() {
        return properties.keySet();
    }

    public Map<String, Serializable> getProperties() {
        return Collections.unmodifiableMap(properties);
    }

    public java.lang.String getEventID() {
        return eventID;
    }

    public void setEventID(String value) {
        eventID = value;
    }

    public java.lang.String getEventName() {
        return this.eventName;
    }

    public void setEventName(java.lang.String eventName) {
        this.eventName = eventName;
    }

    public EventDetails getDetails() {
        return this.details;
    }

    public void setDetails(EventDetails details) {
        this.details = details;
    }

	public String toString() {
		return "Event [eventName=" + eventName + ", details=" + details	+ ", eventID=" + eventID + ", properties=" + properties + "]";
	}
    
}